<?php
include('class/class_connect.php');
include('class/class_page.php');
//include('class/class_comments.php');
//include('class/class_news.php');
//include('class/class_address.php');
//include('class/class_rating.php');
//include('class/tabs/class_tabs.php');
//include('class/abstract/class_mainObjectInfo.php');
include('class/city_rus.php');
include('class/class_checkGetData.php');
//include('class/class_showFullElementOnly.php');
//$check=new checkGetData('firms');
foreach($_GET as $key=>$val)
{
	$_GET[$key]=checkGetData::safetyCheck($val);
}
//$check->checkCity($_GET['city']);
session_start();
if(!isset($_SESSION['login']))header('location: registr.php');
class aFirmPage extends page
{
	var $row=array();
	var $cityRus;
	function __construct()
	{
		$this->cityRus=new city_rus_class();
		parent::__construct();
	}
	function title()
	{
		echo $_SESSION['login'].' - личный кабинет';
	}
	function maincontent()
	{
		$aConnect=new connect('main');
		/*$countMess=mysql_num_rows($aConnect->select_all('messages', "WHERE user='".$_SESSION['login']."' AND status='0'"));
		if($countMess)
		{
			echo ('
			<link rel="stylesheet" type="text/css" href="style/admin.css" />
			<div id="messForm" align="center" style="display: block;">

			');
			$res=$aConnect->select_all('messages', "WHERE user='".$_SESSION['login']."' AND status='0' ORDER BY data");
			while($row=mysql_fetch_array($res))
			{
				$aConnect->update_data('messages', "status='1'", "WHERE id='".$row['id']."'");
				echo ('
				<h4>Вам сообщение от '.$row['sender'].'</h4>
				');
				echo $row['stext'].'<br /><br />';
			}
			echo ('
			<form name="send" action="" method="post">
				Ответить:<br />
				<textarea name="stext" cols="40" rows="5"></textarea><br />
	        	<input type="submit" value="Отправить" name="send">
	        	<a id="close" onclick="document.getElementById(\'messForm\').style.display=\'none\';"></a>
			</form>
			</div>
			');
		}
*/
		echo ('
		<div class="route">
			<div class="routeEl">
				Личный кабинет
			</div>
		</div>
		<link rel="stylesheet" type="text/css" href="style/cabinet.css" />

	        <div class="foto">
			');

		        $aConnect=new connect('main');
				$login= $_SESSION['login'];
				$row=mysql_fetch_array($aConnect->select_all('users', "WHERE login='$login'"));
				$file='avatars/'.$login.'.jpg';
				(file_exists($file))?$avatar=$login:$avatar="гость";
				echo ('
				<image src="avatars/'.$avatar.'.jpg?'.rand().'">
			</div>
			<div class="cabinfo">
		 		<p id="name">'.$row['name'].'&nbsp; '.$row['surname'].'</p>
		 		aka<br>
				<p id="login"> '.$row['login'].'</P>
				 E-mail:&nbsp;'.$row['email'].'
			</div>

			<div class="cab-panel"> <br><br>
			');
			if($row['firms'])
				echo ('
				<a href="my_firms.php?city='.$_GET['city'].'" class="add">Мои фирмы</a>
				');
			echo ('
				<a href="addfirms.php?city='.$_GET['city'].'" class="add">Создать фирму</a>
				<br><br>
			');
			if($row['nets'])
				echo ('
				<a href="my_nets.php?city='.$_GET['city'].'" class="add">Мои сети</a>
				');
			echo ('
				<a href="addnets.php?city='.$_GET['city'].'" class="add">Создать сеть</a>
				<br><br>
			');
			if($row['malls'])
				echo ('
				<a href="my_malls.php?city='.$_GET['city'].'" class="add">Мои центры</a>
				');
			echo ('
				<a href="addmalls.php?city='.$_GET['city'].'" class="add">Создать центр</a>
				<br><br>
				<a href="editprofile.php?city='.$_GET['city'].'" class="add">Редактировать профиль</a><br>
			</div>
		');
	}
}


$aPage=new aFirmPage();

?>